//
//  CloudReserveDateCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/2/27.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

class CloudReserveDateCell: UICollectionViewCell {
    
    @IBOutlet private weak var dateLabel: UILabel! {
        didSet {
            dateLabel.layer.cornerRadius = 8
            dateLabel.layer.masksToBounds = true
            dateLabel.layer.borderWidth = 1
        }
    }
    
    func configure(with vm: CloudReserveDateListViewModel) {
        dateLabel.text = vm.scheduleTime
        if vm.isEnabled {
            dateLabel.layer.borderColor = UIColor.textGray.cgColor
            dateLabel.textColor = .textGray
            isUserInteractionEnabled = true
        } else {
            isUserInteractionEnabled = false
            dateLabel.layer.borderColor = UIColor.textLight.cgColor
            dateLabel.textColor = .textLight
        }
    }
    
    func setSelected(reset: Bool) {
        if reset {
            dateLabel.layer.borderColor = UIColor.textGray.cgColor
            dateLabel.textColor = .textGray
        } else {
            dateLabel.layer.borderColor = UIColor.mainColor.cgColor
            dateLabel.textColor = .mainColor
        }
    }
}
